package com.wfm.lock;

import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;

public class Main2 {

    public static void main(String[] args) throws InterruptedException {
        ReentrantLock lock = new ReentrantLock();
        Condition condition = lock.newCondition();
        try{
            lock.lock();
            condition.awaitNanos(1000*1000*1000*3L);
            System.out.println("1");
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }finally {
            System.out.println("2");
            lock.unlock();
        }
        Thread.sleep(5000);
    }
}
